package com.why.servicecms.controller;


import com.baomidou.mybatisplus.extension.api.R;
import com.why.commonresults.Result;
import com.why.servicecms.bean.CrmBanner;
import com.why.servicecms.service.CrmBannerService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 首页banner表 前端控制器
 * </p>
 *  显示banner的接口
 * @author why
 * @since 2021-02-14
 */
@RestController
@RequestMapping("/servicecms/crm-banner")
@CrossOrigin
public class CrmBannerController {

    @Autowired
    private CrmBannerService bannerService;

    @ApiOperation(value = "获取首页banner")
    @GetMapping("getAllBanner")
    public Result index() {
        //为了后面加入redis方便，写一个service的方法
        List<CrmBanner> list = bannerService.selectIndexList();
        return Result.ok().data("bannerList", list);
    }
}

